function steamrollArray(arr) {
    // 扁平化，扁平化……
    const result = [];
    const getDeep = data => {
        if (!Array.isArray(data)) {
            return result.push(data);
        }
        data.forEach(item => getDeep(item));
    };
    arr.forEach(item => getDeep(item));

    return result;
}

steamrollArray([1, [2], [3, [[4]]]]);
